<html>

<head>
    <meta charset="utf-8" />
    <link rel="stylesheet" type="text/css" href="<%=staticRelativePath%>/normalize.css" />
    <title>static analyse summary report</title>
</head>

<style type="text/css">
      body {
    margin-left: 10%;
    margin-right: 10%;
    padding-top: 20px;
  }
    table {
        border-collapse: collapse;
        table-layout: fixed;
        word-break: break-all;
        text-align: center;
    }
    tr {
        page-break-inside: avoid; 
    }
    th {
        font-weight:bold;
    }
    .font-bold {
        font-weight:bold;  
    }
    .level1 {
        background-color: #B43104;
        color: white;
    }
    .level2 {
        background-color: #fdbb36;
        color: white;
    }
    .level3 {
        background-color: #4dd5b3;
        color: white;
    }
    a {
        text-decoration: none;
     }
    a:visited {
       color: #00e; 
       text-decoration: none; /* 去掉下划线等文本修饰 */
    }
</style>

<body>

    <div>
        <h1 align="center">静态分析<%= isRegression ? '回归测试' : '' %>报告</h1>
        <p align="right">
            <%= reportTime%>
        </p>
        <!-- table 基于 normalize.css 中的样式，标签中style可自定义 -->
        <table border="1" align="center" width="100%">
            <tr>
                <td  class="font-bold" style="text-align: left;">&nbsp;项目名称</td>
                <td colspan="4" style="text-align: left;">
                    <%= projectName%>
                </td>
            </tr>
            <tr>
                <td class="font-bold" style="text-align: left;">&nbsp;版本号</td>
                <td colspan="4" style="text-align: left;">
                    <%= versionName%>
                </td>
            </tr>
            <tr>
                <td rowspan="2" class="font-bold" style="text-align: left;">&nbsp;测试概况<br />&nbsp;(测试对象统计)</td>
                <td class="font-bold">代码行数</td>
                <td class="font-bold">文件</td>
                <td class="font-bold">缺陷总数</td>
                <td class="font-bold">缺陷密度</td>
            </tr>
            <tr>
                <td>
                    <%= numberOfLines%>
                </td>
                <td>
                    <%= fileCount%>
                </td>
                <td>
                    <%= defectsCount%>
                </td>
                <td>
                    <%= kloc%>
                </td>
            </tr>
            <% if(isRegression) { %>
                <tr>
                  <td rowspan="6" class="font-bold" style="text-align: left;">差异性分析结果(测试对象统计)</td>
                </tr>
                <tr>
                  <td class="font-bold">新增代码行数</td>
                  <td colspan="3"><%=diff[0].insertion%></td>
                </tr>
                <tr>
                  <td class="font-bold">删除代码行数</td>
                  <td colspan="3"><%=diff[0].deletion%></td>
                </tr>
                <tr>
                  <td class="font-bold">新增文件（个）</td>
                  <td colspan="3"><%=diff[0].addFiles%></td>
                </tr>
                <tr>
                  <td class="font-bold">修改文件（个）</td>
                  <td colspan="3"><%=diff[0].modifyFiles%></td>
                </tr>
                <tr>
                  <td class="font-bold">删除文件（个）</td>
                  <td colspan="3"><%=diff[0].deleteFiles%></td>
                </tr>
                <% } %>
        </table>
        <br />
        <br />
        <hr />
        <br />
        <div>
            <h2>缺陷统计</h2>
            <div>
                <table border="1" align="left" width="49%" style="text-align: left;margin-top: 15%;">
                    <tr>
                        <th>&nbsp;缺陷等级</th>
                        <th>&nbsp;数量</th>
                    </tr>
                    <tr>
                        <td class="font-bold">&nbsp;强制</td>
                        <td>
                            &nbsp;<%= mandatory%>
                        </td>
                    </tr>
                    <tr>
                        <td class="font-bold">&nbsp;要求/必要/强烈推荐</td>
                        <td>
                            &nbsp;<%= required%>
                        </td>
                    </tr>
                    <tr>
                        <td class="font-bold">&nbsp;建议/推荐</td>
                        <td>
                            &nbsp;<%= advisory%>
                        </td>
                    </tr>
                </table>

                <img width="49%" src="<%=pieImage%>">
            </div>
        </div>

        <br />
        <br />
        <hr />
        <br />

        <div>
            <h2>规范检测结果统计</h2>
            <table border="1" align="center" width="100%">
                <tr>
                    <th>序号</th>
                    <th>规范</th>
                    <th>包含的准则条目</th>
                    <th>检测的缺陷数量</th>
                </tr>
                <% ruleSetMap.forEach(element=> { %>
                    <tr>
                        <td>
                            <%= element.index%>
                        </td>
                        <td>
                            <%= element.ruleSetName%>
                        </td>
                        <td>
                            <%= element.ruleCount%>
                        </td>
                        <td>
                            <%= element.defectCount%>
                        </td>
                    </tr>
                    <% }) %>
            </table>
        </div>

        <br />
        <br />
        <hr />
        <br />

        <div>
            <h2>检测结果复核统计</h2>
            <table border="1" align="center" width="100%">
                <tr>
                    <th>缺陷级别</th>
                    <th>待修改</th>
                    <th>已修改</th>
                    <th>已说明</th>
                    <th>忽略</th>
                    <th>误报</th>
                </tr>
                <% levelStatusMap.forEach(element=> { %>
                    <tr>
                        <td class="font-bold">
                            <%= element.level%>
                        </td>
                        <td>
                            <%= element.status_0%>
                        </td>
                        <td>
                            <%= element.status_1%>
                        </td>
                        <td>
                            <%= element.status_4%>
                        </td>
                        <td>
                            <%= element.status_2%>
                        </td>
                        <td>
                            <%= element.status_3%>
                        </td>
                    </tr>
                    <% }) %>
            </table>
        </div>

        <div style="page-break-before: always;">
            <h2>缺陷类型分析 (TOP 10) </h2>
            <p>
                <%= projectName%> 项目 <%= versionName%> 版本的缺陷类型分析，如表1与图1所示 (前10名) :
            </p>
            <br />
            <h4 align="center">表1: 缺陷类型分析 (TOP10) </h4>
            <table border="1" align="center" width="100%" style="text-align: left;">
                <tr>
                    <th style="width:10%">&nbsp;序号</th>
                    <th style="width:20%">&nbsp;规则信息</th>
                    <th>&nbsp;缺陷类型</th>
                    <th style="width:10%">&nbsp;缺陷数量</th>
                </tr>
                <% rulesTop10.forEach(element=> { %>
                    <tr>
                        <td>
                            &nbsp;<%= element.index%>
                        </td>
                        <td>
                            &nbsp;<%= element.ruleSet%>
                                <br />
                                &nbsp;<%= element.ruleCode%>
                        </td>
                        <td>
                            &nbsp;<%= element.name%>
                        </td>
                        <td>
                            &nbsp;<%= element.total%>
                        </td>
                    </tr>
                    <% }) %>
            </table>
            <br />
            <br />
            <% if (mandatory>0 || required>0 || advisory>0) { %>
                <img width="100%" src="<%=rulesDistributionImage%>">
                <% } %>
                    <h4 align="center">图1: 缺陷类型分析 (TOP10) </h4>
        </div>
        <br />
        <br />

        <div>
            <h2>缺陷文件分析 (TOP 10) </h2>
            <p>
                <%= projectName%> 项目 <%= versionName%> 版本的缺陷文件分析，如表2与图2所示 (前10名) :
            </p>
            <br />
            <h4 align="center">表2: 缺陷文件分析 (TOP10) </h4>
            <table border="1" align="center" width="100%" style="text-align: left;">
                <tr>
                    <th style="width:10%">&nbsp;序号</th>
                    <th>&nbsp;文件</th>
                    <th style="width:15%">&nbsp;缺陷数量</th>
                </tr>
                <% filesTop10.forEach(element=> { %>
                    <tr>
                        <td>
                            &nbsp;<%= element.index%>
                        </td>
                        <td>
                            &nbsp;<%= element.fileName%>
                        </td>
                        <td>
                            &nbsp;<%= element.total%>
                        </td>
                    </tr>
                    <% }) %>
            </table>
            <% if (mandatory>0 || required>0 || advisory>0) { %>
                <img width="100%" src="<%=filesDistributionImage%>">
                <% } %>
                    <h4 align="center">图2: 缺陷文件分析 (TOP10) </h4>
        </div>

        <div style=" page-break-before: always;">
            <h2>风险等级</h2>
            <p>缺陷风险严重等级描述，如表3所示: </p>
            <br />
            <h4 align="center">表3: 风险等级描述 </h4>
            <table border="1" align="center" width="100%" style="text-align: left;">
                <tr>
                    <th style="width:25%;">&nbsp;缺陷严重等级</th>
                    <th>&nbsp;描述</th>
                </tr>
                <tr>
                    <td>&nbsp;强制</td>
                    <td>&nbsp;软件编程中强制要求遵循</td>
                </tr>
                <tr>
                    <td>&nbsp;要求/必要/强烈推荐</td>
                    <td>&nbsp;软件编程中若不遵循需满足一定条件</td>
                </tr>
                <tr>
                    <td>&nbsp;建议/推荐</td>
                    <td>&nbsp;软件编程中推荐参照执行</td>
                </tr>
            </table>
        </div>

        <div style="page-break-before: always;">
            <% if (allRulesBySet) { %>
                <% allRulesBySet.forEach(element=> { %>
                    <h2>
                        <%= element.ruleSetName%>
                    </h2>
                    <p align="right">待修改的缺陷，共<%= element.total%>个</p>
                    <table border="1" align="center" width="100%" style="text-align: left;">
                        <tr>
                            <th style="width:10%;">&nbsp;序号</th>
                            <th style="width:20%;">
                                &nbsp;<%= element.ruleSetName%>
                            </th>
                            <th>&nbsp;简述</th>
                            <th style="width:10%;">&nbsp;缺陷数量</th>
                            <th style="width:10%;">&nbsp;缺陷等级</th>
                        </tr>
                        <% element.rules.level1.forEach(childElement=> { %>
                            <tr>
                                <td>
                                    &nbsp;<%= childElement.index%>
                                </td>
                                <td>
                                    <% if (jumpAble && !noFiles) {
                                        let ruleFile = `${element.ruleSetName}/${childElement.ruleCode}.html`%>
                                        &nbsp;<a href="<%= ruleFile %>" target="_blank"><%= childElement.ruleCode %></a>
                                    <% } else { %>
                                        &nbsp;<%= childElement.ruleCode%>
                                    <% } %>
                                </td>
                                <td>
                                    &nbsp;<%= childElement.name%>
                                </td>
                                <td>
                                    &nbsp;<%= childElement.total%>
                                </td>
                                <td class="level1">
                                    &nbsp;<%= childElement.level%>
                                </td>
                            </tr>
                            <% }) %>
                                <% element.rules.level2.forEach(childElement=> { %>
                                    <tr>
                                        <td>
                                            &nbsp;<%= childElement.index%>
                                        </td>
                                        <td>
                                            <% if (jumpAble && !noFiles) {
                                                let ruleFile = `${element.ruleSetName}/${childElement.ruleCode}.html`%>
                                                &nbsp;<a href="<%= ruleFile %>" target="_blank"><%= childElement.ruleCode %></a>
                                            <% } else { %>
                                                &nbsp;<%= childElement.ruleCode%>
                                            <% } %>
                                        </td>
                                        <td>
                                            &nbsp;<%= childElement.name%>
                                        </td>
                                        <td>
                                            &nbsp;<%= childElement.total%>
                                        </td>
                                        <td class="level2">
                                            &nbsp;<%= childElement.level%>
                                        </td>
                                    </tr>
                                    <% }) %>
                                        <% element.rules.level3.forEach(childElement=> { %>
                                            <tr>
                                                <td>
                                                    &nbsp;<%= childElement.index%>
                                                </td>
                                                <td>
                                                    <% if (jumpAble && !noFiles) {
                                                        let ruleFile = `${element.ruleSetName}/${childElement.ruleCode}.html`%>
                                                        &nbsp;<a href="<%= ruleFile %>" target="_blank"><%= childElement.ruleCode %></a>
                                                    <% } else { %>
                                                        &nbsp;<%= childElement.ruleCode%>
                                                    <% } %>
                                                </td>
                                                <td>
                                                    &nbsp;<%= childElement.name%>
                                                </td>
                                                <td>
                                                    &nbsp;<%= childElement.total%>
                                                </td>
                                                <td class="level3">
                                                    &nbsp;<%= childElement.level%>
                                                </td>
                                            </tr>
                                            <% }) %>
                    </table>
                    <% }) %>
                        <% } %>
        </div>
    </div>
</body>

</html>